/**
 * 自动导入script api定义
 * 文件夹类型
 *   文件类型
 * 
 * [
 * {
 * name:string,
 * children:[
 *  {name:string,src:string}
 * ]}
 * ]
      流程
      1.导入所有js标签
        工作流程：
          1.在js文件里会执行时调用mainList.push()方法添加
    */

//导航的数据
   let navList = [
    {
    name:'api',
    children:[
      {name:'base',src:'./api/base.js'},
      {name:'shape',src:'./api/shape.js'},
    ]
  },
     {
    name: 'animation',
    children: [
      {name:'base',src:'./animation/base.js'}
    ]
  },
  {
    name:'shape'
  }
]
/**
 * 内容的数据 mainList
 * api定义
 * {
 * name:string
 * list:[
 * name:string,
 * description:string
 * code:string
 * ]
 * }
 */
let mainData={}
init()
function init() {
    initNav() //头部导航
  }
function initNav() {
    let html = navTemplate(navList)
    $('#headBox').html(html)
}
function initContent() {
  $('#content').html('')
  contentTemplate(mainData, $('#content'))
}

function watchScriptInit() {
  initContent() //内容
}
 
//nav点击监听
$('.dropdown-item').click(function (e) {
  let src = $(e.target).attr('src')
  let script = document.createElement('script')
  script.src = src
  document.body.appendChild(script)
})